---
title: Kbd
description: A component for displaying keyboard keys and shortcuts.
---

<ComponentPreview name="p-kbd-1" />

## Installation

<CodeTabs>

<TabsList>
  <TabsTab value="cli">CLI</TabsTab>
  <TabsTab value="manual">Manual</TabsTab>
</TabsList>
<TabsPanel value="cli">

```bash
npx shadcn@latest add @coss/kbd
```

</TabsPanel>

<TabsPanel value="manual">

<Steps>

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="kbd" title="components/ui/kbd.tsx" />

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsPanel>

</CodeTabs>

## Usage

```tsx
import { Kbd, KbdGroup } from "@/components/ui/kbd"
```

Single key:

```tsx
<Kbd>K</Kbd>
```

Multiple keys (key combination):

```tsx
<KbdGroup>
  <Kbd>⌘</Kbd>
  <Kbd>K</Kbd>
</KbdGroup>
```

## Examples

### Input Group

<ComponentPreview name="input-group-with-kbd" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />

## API Reference

### Kbd

Displays a single keyboard key.

| Prop        | Type     | Default |
| ----------- | -------- | ------- |
| `className` | `string` |         |

```tsx
<Kbd>⌘K</Kbd>
```

### KbdGroup

Groups multiple keyboard keys for key combinations.

| Prop        | Type     | Default |
| ----------- | -------- | ------- |
| `className` | `string` |         |

```tsx
<KbdGroup>
  <Kbd>⌘</Kbd>
  <Kbd>K</Kbd>
</KbdGroup>
```
